package br.com.lacibMusic.rn;

import br.com.lacibMusic.dao.DiscoDAO;
import br.com.lacibMusic.entidades.Disco;
import br.com.lacibMusic.dao.GenericDAO;
import br.com.lacibMusic.entidades.Album;
import java.util.List;

public class DiscoRN {

    private final GenericDAO dao = new GenericDAO();
    private final DiscoDAO discoDao = new DiscoDAO();
    
    public Disco novo() {
        return new Disco();
    }

    public boolean salvar(Disco c) {
        if (c.getId() == null) {
            return dao.criar(c);
        } else {
            return dao.alterar(c);
        }
    }

    public boolean remover(Disco c) {
        //return dao.excluir(c);
        return dao.excluir(c, c.getId());
    }

    public Disco obter(Integer id) {
        return (Disco) dao.obter(Disco.class, id);
    }

    public List<Disco> obterPorAlbum(Album album) {
        return discoDao.obterObra(Disco.class, album);
    }

    public List<Disco> obterTodos() {
        return dao.obterTodos(Disco.class);
    }
    
    public List<Disco> obterPorNome(String nome) {
        return discoDao.obterPorNome(Disco.class, nome);
    }

    public List<Disco> obterTodosPorAlbum(Album album) {
        return discoDao.obterTodosPorAlbum(Disco.class, album);
    }
}
